project(
    'mcpy',
    'cpp',
    version: '0.1.0',
    default_options: [
        'warning_level=3',
        'cpp_std=c++17',
        'libdir=lib',
        'cpp_args=-fPIC -Wall -Wno-unused-parameter -Wno-unused-variable -Wno-sign-compare -Wno-pedantic -Wno-deprecated-copy',
        'default_library=static',
    ],
)

# 添加编译器选项
add_project_arguments('-Wall', '-Wextra', '-fvisibility=hidden', language: 'cpp')

if meson.get_compiler('cpp').get_id() == 'clang'
    add_project_arguments('-Wno-#warnings', language: 'cpp')
endif

# 获取构建选项
build_tests = get_option('tests')

# 包含子项目拉取依赖项目
libmcpp_dep = dependency(
    'libmcpp',
    fallback: ['libmcpp', 'libmcpp_dep'],
    default_options: ['tests=false'],
    required: false,
)
gtest_dep = dependency('gtest', required: false)

py = import('python')
venv_py = join_paths(meson.project_source_root(), 'venv', 'bin', 'python3')
python3 = py.find_installation(venv_py, modules: [], required: false)
if not python3.found()
    python3 = py.find_installation('python3', modules: [], required: true)
endif

subdir('src')

# # 构建示例
# if get_option('examples')
#     subdir('examples')
# endif

# 构建测试
if build_tests
    subdir('tests/pytests')
    subdir('tests/gtests')
endif